From 8be92e16c59486b7270d53f43b6b93adf3cd21a3 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Mon, 25 May 2020 11:52:58 -0600 Subject: [PATCH] Fail configuration if libusb-1.0 is not found (#564) * have configure fail if libusb is enabled and not found. * correct indentation in configure. --- configure | 21 ++++++++++++++++----- configure.ac | 11 +++++++---- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 375a7fdc1..8819601ce 100755 --- a/configure +++ b/configure @@ -728,6 +728,7 @@ enable_csv enable_most enable_filters with_zlib +with_libusb with_doc ' ac_precious_vars='build_alias @@ -1377,6 +1378,7 @@ Optional Packages: --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-zlib=(included)|system|no + --without-libusb disable support for libusb --with-doc=DIR Path where the documentation will be stored. Some influential environment variables: @@ -6261,17 +6263,21 @@ fi *) : GBSER=gbser_posix.o - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libusb-1.0" >&5 -$as_echo_n "checking for libusb-1.0... " >&6; } + +# Check whether --with-libusb was given. +if test "${with_libusb+set}" = set; then : + withval=$with_libusb; +else + with_libusb=yes +fi + if test "$with_libusb" = "no"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: check not done" >&5 -$as_echo "check not done" >&6; } OSJEEPS=jeeps/gpsusbstub.o else - + # Die if libusb-1.0 not found. This prevents link failures later. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libusb_init in -lusb-1.0" >&5 $as_echo_n "checking for libusb_init in -lusb-1.0... " >&6; } if ${ac_cv_lib_usb_1_0_libusb_init+:} false; then : @@ -6315,6 +6321,11 @@ _ACEOF LIBS="-lusb-1.0 $LIBS" +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "libusb-1.0 not found (--without-libusb to disable) +See \`config.log' for more details" "$LINENO" 5; } fi OSJEEPS=jeeps/gpslibusb.o diff --git a/configure.ac b/configure.ac index 4a03e867c..a6b9ae01d 100644 --- a/configure.ac +++ b/configure.ac @@ -229,13 +229,16 @@ AS_CASE(["$target"], [*-*-cygwin* | *-*-mingw32*], [ QT_SYSINC_OPT="-iframework" ], [ GBSER=gbser_posix.o - AC_MSG_CHECKING(for libusb-1.0) + AC_ARG_WITH([libusb], + [AS_HELP_STRING([--without-libusb], [disable support for libusb])], + [], + [with_libusb=yes]) AS_IF([test "$with_libusb" = "no"], [ - AC_MSG_RESULT(check not done) OSJEEPS=jeeps/gpsusbstub.o ], [ - - AC_CHECK_LIB([usb-1.0], [libusb_init]) + # Die if libusb-1.0 not found. This prevents link failures later. + AC_CHECK_LIB([usb-1.0], [libusb_init], [], + [AC_MSG_FAILURE(libusb-1.0 not found (--without-libusb to disable))]) OSJEEPS=jeeps/gpslibusb.o ]) ]) -- 2.30.2